package server.unknow;

import pack.ClientToServer;

public class PackFactory {
	private DoAble doAble;

	public PackFactory(DoAble doAble) {
		this.doAble = doAble;
	}

	public void process(ClientToServer serverReceivePack) {
		switch (serverReceivePack.getOperate()) {
		case INITIAL:
			doAble.receive(serverReceivePack.getMessage());
			break;
		case RECEIVE:
			doAble.receive(serverReceivePack.getMessage());
			break;
		case SENDMESSAGETOONE:
			doAble.sendMessageToOne(serverReceivePack);
			break;
		case SENDMESSAGETOALL:
			doAble.sendMessageToAll(serverReceivePack);
		}
	}
}
